<?php
require_once(dirname(dirname(__FILE__)) . '/app.php');

$staffId = $_GET['staffId'];
$skillId = $_GET['serviceId'];
$resetTime = $_GET['resetTime'];
$action = $_GET['action'];
$temp = StaffSkill::GetByStaffAndSkill($staffId, $skillId);

if("add" == $action){
	if( $temp == null ){
		StaffSkill::Create($staffId, $skillId, $resetTime, $resetTime);
		$service = Service::GetById($skillId);
		Output::Json($service['service_name']."(level:".$resetTime.")", 0);
	}else{
		Output::Json(null, 1);
	}
}else{
	if( $temp == null ){
		Output::Json(null, 1);
	}else{
		StaffSkill::DeleteBySS($staffId, $skillId);
		$service = Service::GetById($skillId);
		Output::Json($service['service_name'], 0);
	}
}
